/*************************************************************************
 * Copyright (C) [2022] by Cambricon, Inc. All rights reserved
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *************************************************************************/

#include <algorithm>
#include <memory>
#include <string>
#include <utility>

#include "inference.hpp"

#include "preprocess/preprocess_yolov3.hpp"
#include "postprocess/postprocess_yolov3.hpp"
#include "preprocess/preprocess_classification.hpp"
#include "postprocess/postprocess_classification.hpp"

int Inference::Open() {

  return 0;
}

int Inference::Process(std::shared_ptr<EdkFrame> frame) {

  Transmit(frame);
  return 0;
}


int Inference::Close() {

  return 0;
}


// class Infer : public Module {
//  public:
//   Infer(std::string name, int parallelism) : Module(name, parallelism) {

//   }

//   ~Infer() = default;

//   int Open() override {
//     return 0;
//   }

//   int Process(std::shared_ptr<EdkFrame> frame) override {
//     // std::cout << "Infer: " << __FUNCTION__ << std::endl;
//     std::cout << "frame stream id: "<< frame->stream_id << ", frame idx: " << frame->frame_idx << std::endl;
//     // std::this_thread::sleep_for(std::chrono::microseconds(200));
//     // std::cout << "stream_id: " << frame->stream_id << ", is eos: " << frame->is_eos << std::endl;
//     Transmit(frame);
//     return 0;
//   }

//   int Close() override {
//     return 0;
//   }

// };
